﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FubiManger.UI;

namespace FubiManger.Controls
{
    ////ToolboxItem用于控制是否添加自定义控件到工具箱，true添加，false不添加
    //[System.ComponentModel.ToolboxItem(true)]
    partial class packetcontrol : Smobiler.Core.Controls.MobileUserControl
    {
        public packetcontrol() : base()
        {
            //This call is required by the SmobilerUserControl.
            InitializeComponent();
        }
        /// <summary>
        /// 红包
        /// </summary>
        public string moeny { get; set; }
        /// <summary>
        /// 等级
        /// </summary>
        public string level { get; set; }
        /// <summary>
        /// 范围
        /// </summary>
        public string rank { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        public  DateTime starttime { get; set; }
        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime endtime { get; set; }
        /// <summary>
        /// 参与方式
        /// </summary>
        public string way { get; set; }
        /// <summary>
        /// 红包活动ID
        /// </summary>

        public string p_id { get; set; }
        private void packetcontrol_Load(object sender, EventArgs e)
        {
            lbllevel.Text = "等级 VIP " + level + "-7";
            lblmoney.Text = moeny + "元";
            if (way == "1")
                lblrank.Text = "范围 全网";
            else
                lblrank.Text = "范围 " + rank + "内";
            lbltime.Text = "活动时间 " + starttime;
            DateTime dt = DateTime.Now;
            if (DateTime.Compare(starttime, dt) > 0 && DateTime.Compare(endtime, dt) > 0)
            {
                lblstatus.BackColor = System.Drawing.Color.FromArgb(255, 244, 232);
                lblstatus.ForeColor = System.Drawing.Color.FromArgb(254, 177, 101);
                lblstatus.Text = "未开始";
            }
            else if (DateTime.Compare(dt, endtime) > 0)
            {
                lblstatus.BackColor = System.Drawing.Color.FromArgb(194, 194, 194);
                lblstatus.ForeColor = System.Drawing.Color.FromArgb(249, 249, 249);
                lblstatus.Text = "已结束";
            }
            else
            {
                lblstatus.Text = "进行中";
                lblstatus.BackColor = System.Drawing.Color.FromArgb(237, 246, 255);
                lblstatus.ForeColor = System.Drawing.Color.FromArgb(76, 151, 230);
            }
        }

        private void panel1_Press(object sender, EventArgs e)
        {
            PacketRecordForm frm = new PacketRecordForm();
            frm.pr_pactiyid = p_id;//红包活动ID
            this.Form.Show(frm, true);
        }
    }
}